package com.zhengshang.api.service.impl;

import java.util.List;
import java.util.Map;

import com.zhengshang.api.domain.AppGoodsCategory;
import com.zhengshang.api.mapper.AppGoodsCategoryMapper;
import com.zhengshang.api.service.IAppGoodsCategoryService;
import com.zhengshang.common.utils.DateUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

/**
 * 商品分类Service业务层处理
 *
 * @author zhengshang
 * @date 2022-04-13
 */
@Service
public class AppGoodsCategoryServiceImpl implements IAppGoodsCategoryService {
    @Autowired
    private AppGoodsCategoryMapper appGoodsCategoryMapper;

    /**
     * 查询商品分类
     *
     * @param goodsCategoryId 商品分类ID
     * @return 商品分类
     */
    @Override
    public AppGoodsCategory selectAppGoodsCategoryById(Long goodsCategoryId) {
        return appGoodsCategoryMapper.selectAppGoodsCategoryById(goodsCategoryId);
    }

    /**
     * 查询商品分类列表
     *
     * @param appGoodsCategory 商品分类
     * @return 商品分类
     */
    @Override
    public List<AppGoodsCategory> selectAppGoodsCategoryList(AppGoodsCategory appGoodsCategory) {
        return appGoodsCategoryMapper.selectAppGoodsCategoryList(appGoodsCategory);
    }

    /**
     * 查询商品分类列表
     *
     * @param params
     * @return 商品分类
     */
    @Override
    public List<Map> selectAppGoodsCategoryList1(Map params) {
        return appGoodsCategoryMapper.selectAppGoodsCategoryList1(params);
    }

    /**
     * 新增商品分类
     *
     * @param appGoodsCategory 商品分类
     * @return 结果
     */
    @Override
    public int insertAppGoodsCategory(AppGoodsCategory appGoodsCategory) {
        appGoodsCategory.setCreateTime(DateUtils.getNowDate());
        return appGoodsCategoryMapper.insertAppGoodsCategory(appGoodsCategory);
    }

    /**
     * 修改商品分类
     *
     * @param appGoodsCategory 商品分类
     * @return 结果
     */
    @Override
    public int updateAppGoodsCategory(AppGoodsCategory appGoodsCategory) {
        appGoodsCategory.setUpdateTime(DateUtils.getNowDate());
        return appGoodsCategoryMapper.updateAppGoodsCategory(appGoodsCategory);
    }

    /**
     * 批量删除商品分类
     *
     * @param goodsCategoryIds 需要删除的商品分类ID
     * @return 结果
     */
    @Override
    public int deleteAppGoodsCategoryByIds(Long[] goodsCategoryIds) {
        return appGoodsCategoryMapper.deleteAppGoodsCategoryByIds(goodsCategoryIds);
    }

    /**
     * 删除商品分类信息
     *
     * @param goodsCategoryId 商品分类ID
     * @return 结果
     */
    @Override
    public int deleteAppGoodsCategoryById(Long goodsCategoryId) {
        return appGoodsCategoryMapper.deleteAppGoodsCategoryById(goodsCategoryId);
    }

    @Override
    public List<AppGoodsCategory> selectAppGoodsCategoryByNavigateId(Long navigateId) {
        return appGoodsCategoryMapper.selectAppGoodsCategoryByNavigateId(navigateId);
    }
}
